package com.cloudspace.jindun.window;

import android.app.AlertDialog;
import android.app.Dialog;
import android.content.Context;
import android.content.Intent;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.TextView;

import com.cloudspace.jindun.R;
import com.cloudspace.jindun.activity.WdActivity;

/**
 * User: Cloud(32325596@qq.com)
 * Date: 2016-12-30
 * Time: 18:56
 * project: jindunnew
 * Describe 窗口提示
 */
public class DialogMess {
    public Dialog showDialog(final Context context, int type,String title,String neirong,String left,String right) {
        View view = LayoutInflater.from(context).inflate(R.layout.alert_dialogpass, null);

        final Dialog dialog = new AlertDialog.Builder(context).setView(view).create();

        dialog.show();
        TextView leftView = (TextView) view.findViewById(R.id.pass_text_left);
        TextView rightView = (TextView) view.findViewById(R.id.pass_text_right);
        TextView titleView = (TextView) view.findViewById(R.id.pass_text_tishi);
        TextView neirongView = (TextView) view.findViewById(R.id.pass_text_neirong);
        switch (type){
            case 1:
                titleView.setText(title);
                neirongView.setText(neirong);
                leftView.setText(left);
                rightView.setVisibility(View.GONE);
                break;
            case 2:
                titleView.setText(title);
                neirongView.setText(neirong);
                leftView.setText(left);
                rightView.setText(right);
                break;
        }



        leftView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent=new Intent();
                intent.setClass(context, WdActivity.class);
                context.startActivity(intent);
            }
        });
        rightView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                dialog.dismiss();
            }
        });

        return dialog;
    }
}
